package com.chak.voyage.data.mapper;

import com.chak.voyage.data.entity.TDuplicate;
import com.chak.voyage.data.entity.TDuplicateExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TDuplicateMapper {
    @SelectProvider(type=TDuplicateSqlProvider.class, method="countByExample")
    int countByExample(TDuplicateExample example);

    @DeleteProvider(type=TDuplicateSqlProvider.class, method="deleteByExample")
    int deleteByExample(TDuplicateExample example);

    @Delete({
        "delete from t_duplicate",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into t_duplicate (type, url, ",
        "create_time)",
        "values (#{type,jdbcType=INTEGER}, #{url,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(TDuplicate record);

    @InsertProvider(type=TDuplicateSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(TDuplicate record);

    @SelectProvider(type=TDuplicateSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="url", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TDuplicate> selectByExample(TDuplicateExample example);

    @Select({
        "select",
        "id, type, url, create_time",
        "from t_duplicate",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="url", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    TDuplicate selectByPrimaryKey(Integer id);

    @UpdateProvider(type=TDuplicateSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TDuplicate record, @Param("example") TDuplicateExample example);

    @UpdateProvider(type=TDuplicateSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") TDuplicate record, @Param("example") TDuplicateExample example);

    @UpdateProvider(type=TDuplicateSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TDuplicate record);

    @Update({
        "update t_duplicate",
        "set type = #{type,jdbcType=INTEGER},",
          "url = #{url,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TDuplicate record);
}